$(document).ready(function() {
	$('.menubtn').click(function(){
		$('.sidebar').fadeIn();
		autohide_sidebar();
	});
	$('.avatar').click(function(){
		$('#member-menu').fadeIn(100);
		autohide_membermenu();
	});
	$('#member-menu li a').click(function(){
		$('#member-menu').fadeOut(300);
	});
});
function autohide_membermenu(){
	if($("#member-menu:hover").length > 0) return setTimeout(autohide_membermenu, 500);
	if($(".avatar:hover").length > 0) return setTimeout(autohide_membermenu, 500);
	$('#member-menu').fadeOut(300);
}
function autohide_sidebar(){
	if($(".sidebar:hover").length > 0) return setTimeout(autohide_sidebar, 500);
	if($(".menubtn:hover").length > 0) return setTimeout(autohide_sidebar, 500);
	$('.sidebar').fadeOut();
}